define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'jizhan.return_point_user/index',
        add_url: 'jizhan.return_point_user/add',
        edit_url: 'jizhan.return_point_user/edit',
        delete_url: 'jizhan.return_point_user/delete',
        export_url: 'jizhan.return_point_user/export',
        modify_url: 'jizhan.return_point_user/modify',
        fd_order_detail_url: 'jizhan.return_point_order/index',
        fd_order_get_url: 'jizhan.return_point_order/index?type=huoqu',
        fd_order_day_url: 'jizhan.return_point_order_day/index',
    };
    var Controller = {

        index: function () {
            ea.table.render({
                /*用户id,用户名称,用户号码,用户身份,用户购买订单实付总金额,用户产生返点总金额,返点订单明细*/
                init: init,
                cols: [[
                    {type: "checkbox"},
                    {field: 'uid', title: '用户id'},
                    {field: 'real_name',title: '用户名称' },
                    {field: 'phone',title: '用户号码' },
                    {field: 'jmyc_grade',title: '用户身份' , search: 'no'},
                    {field: 'buyPayPrice',title: '用户购买订单实付总金额', search: 'no' },
                    {field: 'sumReturnPrice',title: '用户产生返点总金额' , search: 'no'},
                    {field: 'ownReturnPrice',title: '用户当前返点总金额', search: 'no' },
                    {field: 'hasReturnPrice',title: '用户当前剩余返点金额' , search: 'no'},
                    {
                        title: '操作', templet: ea.table.tool,
                        operat: [
                            [
                                {
                                    text: '产生返点订单明细',
                                    extra:'name',
                                    url: init.fd_order_detail_url,
                                    method: 'open',
                                    auth: 'edit',
                                    class: 'layui-btn layui-btn-xs layui-btn-success',
                                    extend: 'data-full="true"',
                                },
                                {
                                    text: '获取返点订单明细',
                                    extra:'name',
                                    url: init.fd_order_get_url,
                                    method: 'open',
                                    auth: 'edit',
                                    class: 'layui-btn layui-btn-xs layui-btn-success',
                                    extend: 'data-full="true"',
                                },
                                {
                                    text: '获取返点每日统计',
                                    extra:'name',
                                    url: init.fd_order_day_url,
                                    method: 'open',
                                    auth: 'edit',
                                    class: 'layui-btn layui-btn-xs layui-btn-success',
                                    extend: 'data-full="true"',
                                }
                            ]
                        ]
                    }
                ]],
            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});